# ----------------------------------------------------------------------
# ' this file uses opioid prescription files for each quarter
# ' to generate a list of opioid takers in each quarter
# ' by BK (bl11@indiana.edu)
# ----------------------------------------------------------------------

load_library = c('bit64','data.table','fst','future.apply','stringr','logger')
invisible(lapply(load_library, function(x) library(x, character.only=TRUE, quietly= TRUE)))
options(scipen=999)

bucket = file.path('/N','project','iuni_doctorshopping')

# read arguments
args=commandArgs(TRUE)
infile = args[[1]]
outfile = args[[2]]

data = fread(infile)

# make a unique list
unique_patlist = unique(data[,'PATID'])

fwrite(unique_patlist, outfile)



